package com.barry.pattern.dutyList;

import com.barry.pattern.BaseMode;

public class DutyList extends BaseMode implements Runnable {

	public DutyList(String modeName) {
		super(modeName);
	}


	/**
	 * 职责链模式
	 */
	static void dutyList() {
		Officer admiral_obama = new Admiral("obama");

		Officer general_tank = new General("tank");
		Officer general_roserfur = new General("roserfur");
		admiral_obama.addSubordinate(general_roserfur);
		admiral_obama.addSubordinate(general_tank);

		Officer major_jack = new Major("jack");
		Officer major_bluse = new Major("bluse");
		Officer major_maxswell = new Major("maxswell");
		general_tank.addSubordinate(major_jack);
		general_roserfur.addSubordinate(major_bluse);
		general_tank.addSubordinate(major_maxswell);

		Officer captain_curk = new Captain("curk");
		Officer captain_vano = new Captain("vano");
		Officer captain_asher = new Captain("asher");
		Officer captain_danis = new Captain("danis");
		Officer captain_cluser = new Captain("cluser");

		major_bluse.addSubordinate(captain_curk);
		major_maxswell.addSubordinate(captain_vano);
		major_bluse.addSubordinate(captain_asher);
		major_jack.addSubordinate(captain_danis);
		major_maxswell.addSubordinate(captain_cluser);

		captain_danis.getAction("嘘嘘上课撒尿", 3);
		captain_danis.getAction("小刘请假1天", 4);
		major_maxswell.getAction("大色魔娶媳妇", 5);
		general_roserfur.getAction("对日本宣战", 9);
		captain_danis.getAction("小徐和小辉睡觉", 10);

	}
	@Override
	public void run() {
		dutyList();		
	}

}
